/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tv.global.modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ctrosch
 */

@Entity
@Table(name="GRTVAL")
public class MonedaValores implements Serializable {

    @EmbeddedId
    private MonedaValoresPK id;

    @Column(name = "GRTVAL_FECCAL")
    @Temporal(TemporalType.DATE)
    private Date feccal;

    @Column(name = "GRTVAL_VALORI", nullable = false, precision=2, scale=10)
    private BigDecimal valori;

    @Column(name = "GRTVAL_DEBAJA", nullable = false)
    private String debaja;

    public MonedaValores() {
        this.debaja = "N";
        this.valori = new BigDecimal(BigInteger.ZERO);
    }

    public MonedaValores(MonedaValoresPK id) {
        this.id = id;
        this.debaja = "N";
        this.valori = new BigDecimal(BigInteger.ZERO);
    }

    public MonedaValores(MonedaValoresPK id, Date feccal, BigDecimal valori) {
        this.id = id;
        this.feccal = feccal;
        this.valori = valori;
        this.debaja = "N";
    }
    
    public String getDebaja() {
        return debaja;
    }

    public void setDebaja(String debaja) {
        this.debaja = debaja;
    }

    public Date getFeccal() {
        return feccal;
    }

    public void setFeccal(Date feccal) {
        this.feccal = feccal;
    }

    public MonedaValoresPK getId() {
        return id;
    }

    public void setId(MonedaValoresPK id) {
        this.id = id;
    }

    public BigDecimal getValori() {
        return valori;
    }

    public void setValori(BigDecimal valori) {
        this.valori = valori;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final MonedaValores other = (MonedaValores) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 23 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }


}
